Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

const_eval: implies_by in rustc_const_unstable #107801

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

davidtwco
Copy link
Member

Fixes #107605.

Extend support for implies_by (from #[stable] and #[unstable]) to #[rustc_const_stable] and #[rustc_const_unstable].

cc @steffahn

@rustbot
Copy link
Collaborator

rustbot commented Feb 8, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 8, 2023
@steffahn
Copy link
Member

steffahn commented Feb 8, 2023

Haven’t tried understanding the code in actual detail, but I’m wondering why the implications are separated for the const and non-const case. Same feature flag could gate some normal #[unstable] items and also some other #[rustc_const_unstable] items, couldn’t it? If the feature gates can overlap, wouldn’t a unified table of implications make sense, too?


While I’m at it, commenting on the general design… one small downside of the implied_by directionality (as opposed to implies) is that the setting I layed out in the original Zulip thread where a piece of API could be moved to a new feature flag multiple times is no longer so well supported. I do see benefits with this directionality, in particular that the stabilized items will never need to be touched again, but it makes me wonder whether perhaps also allowing a list of multiple features in the implied_by field could be reasonable.

Feel free to ignore this second part of the comment though, as it’s not directly relevant to the PR at hand, I suppose. (And also the use-case should be rather uncommon (and we’re still talking about unstable features anyways), so it’s not a pressing issue.)

Extend support for `implies_by` (from `#[stable]` and `#[unstable]`)
to `#[rustc_const_stable]` and `#[rustc_const_unstable]`.

Signed-off-by: David Wood <david.wood@huawei.com>
@davidtwco davidtwco force-pushed the stability-implies-const branch from b9dd340 to 9127834 Compare February 8, 2023 15:09
@davidtwco
Copy link
Member Author

davidtwco commented Feb 8, 2023

Haven’t tried understanding the code in actual detail, but I’m wondering why the implications are separated for the const and non-const case. Same feature flag could gate some normal #[unstable] items and also some other #[rustc_const_unstable] items, couldn’t it? If the feature gates can overlap, wouldn’t a unified table of implications make sense, too?

This makes sense, I've updated it to this.

While I’m at it, commenting on the general design… one small downside of the implied_by directionality (as opposed to implies) is that the setting I layed out in the original Zulip thread where a piece of API could be moved to a new feature flag multiple times is no longer so well supported. I do see benefits with this directionality, in particular that the stabilized items will never need to be touched again, but it makes me wonder whether perhaps also allowing a list of multiple features in the implied_by field could be reasonable.

I think I went with the current directionality for the advantage you've noted. Extending the current approach to accept a list of features makes most sense if we were to do this (though I'm not sure if it's worth it if there isn't a need for that).

@steffahn
Copy link
Member

steffahn commented Feb 8, 2023

Thanks for the quick response.

While I’m at it, more small general thoughts where just asking seems faster than me trying to figure it out from the code of testing: Given that previously, apparently implied_by was allowed but silently ignored inside the rustc_const_unstable attribute… I guess the first though/question is: is there – in general – a check that checks what kind of key-value pairs are allowed in such attributes, and if yes, why was it previously allowing the implied_by on the rustc_const_unstable? Do they kind-of “share the syntax”? My point is that we probably don’t ever want implied_by in a #[stable] or #[rustc_const_stable] attribute (right? or is there any usefulness in something like that?), and helping rustc library authors with a lint or error for this seems like a useful idea.

@apiraino
Copy link
Contributor

apiraino commented Mar 2, 2023

(hope it's fine to reroll reviewer, was autoassigned)

r? compiler

@rustbot rustbot assigned Noratrieb and unassigned wesleywiser Mar 2, 2023
@Noratrieb
Copy link
Member

Would be nice if the stability and const stability code was a little more unified in the future.
Having stricter checking around stability attributes as mentioned by @steffahn would also be useful, but that's also something for a follow-up PR if deemed useful.
The implementation here looks good.
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 6, 2023

📌 Commit 9127834 has been approved by Nilstrieb

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 6, 2023
… r=Nilstrieb

const_eval: `implies_by` in `rustc_const_unstable`

Fixes rust-lang#107605.

Extend support for `implies_by` (from `#[stable]` and `#[unstable]`) to `#[rustc_const_stable]` and `#[rustc_const_unstable]`.

cc `@steffahn`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 6, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#107801 (const_eval: `implies_by` in `rustc_const_unstable`)
 - rust-lang#108750 (Fix `ObligationCtxt::sub`)
 - rust-lang#108780 (Add regression tests for issue 70919)
 - rust-lang#108786 (Check for free regions in MIR validation)
 - rust-lang#108790 (Do not ICE when interpreting a cast between non-monomorphic types)
 - rust-lang#108803 (Do not ICE when failing to normalize in ConstProp.)
 - rust-lang#108807 (Emit the suspicious_auto_trait_impls for negative impls as well)
 - rust-lang#108812 (Add regression test for rust-lang#98444)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9c99a4c into rust-lang:master Mar 7, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 7, 2023
@davidtwco davidtwco deleted the stability-implies-const branch March 7, 2023 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implied_by not working with const-stability?
7 participants